{extend name="layout" /}
{block name="body"}
  <div class="row">
          
    <div class="col-lg-12">
      <div class="card">
        <ul class="nav nav-tabs page-tabs pt-2 pl-3 pr-3">
          {volist name="$tab_list" id="gvo"}
          <li  class="nav-item">
            <a href="{$gvo['url']}" class="nav-link {eq name="$group" value="$gvo['group']"} active{/eq}">{$gvo['title']}</a>
          </li>
          {/volist}
        </ul>
        <div class="tab-content">
          {if condition="$group == 'export'"}
          <div class="d-flex flex-column flex-md-row mb-2">
            <div class="toolbar-btn-action">
              {if condition="check_rule('admin/database/export', [1,2,3])"}
              <a class="btn btn-success m-r-5 ajax-post confirm" href="{:url('database/export')}" target-form="ids"><i class="mdi mdi-content-copy"></i> 立即备份</a>
              {/if}
              {if condition="check_rule('admin/database/optimize', [1,2,3])"}
              <a class="btn btn-warning m-r-5 ajax-post confirm" href="{:url('database/optimize')}" target-form="ids"><i class="mdi mdi-cogs"></i> 优化表</a>
              {/if}
              {if condition="check_rule('admin/database/repair', [1,2,3])"}
              <a class="btn btn-warning m-r-5 ajax-post confirm" href="{:url('database/repair')}" target-form="ids"><i class="mdi mdi-wrench-outline"></i> 修复表</a>
              {/if}
            </div>
          </div>
          {/if}
          <div class="table-responsive">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th>
                    <div class="custom-control custom-checkbox">
                      <input type="checkbox" class="custom-control-input" id="check-all">
                      <label class="custom-control-label" for="check-all"></label>
                    </div>
                  </th>
                  <th>表名</th>
                  <th>行数</th>
                  <th>大小</th>
                  <th>冗余</th>
                  <th>备注</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                {volist name="list" id="vo"}
                <tr>
                  <td>
                    <div class="custom-control custom-checkbox">
                      <input type="checkbox" class="custom-control-input ids" name="ids[]" value="{$vo.name}" id="ids-{$vo.name}">
                      <label class="custom-control-label" for="ids-{$vo.name}"></label>
                    </div>
                  </td>
                  <td>{$vo.name}</td>
                  <td>{$vo.rows}</td>
                  <td>{$vo.data_length|format_bytes}</td>
                  <td>{$vo.data_free|format_bytes}</td>
                  <td>{$vo.comment}</td>
                  <td>
                    <div class="btn-group">
                      {if condition="check_rule('admin/database/optimize', [1,2,3])"}
                      <a class="btn btn-xs btn-default ajax-get" href="{:url('database/optimize', 'ids='.$vo['name'])}" title="优化表" data-toggle="tooltip" data-original-title="优化表"><i class="mdi mdi-cogs"></i></a>
                      {/if}
                      {if condition="check_rule('admin/database/repair', [1,2,3])"}
                      <a class="btn btn-xs btn-default ajax-get" href="{:url('database/repair', 'ids='.$vo['name'])}" title="修复表" data-toggle="tooltip" data-original-title="修复表"><i class="mdi mdi-wrench"></i></a>
                      {/if}
                    </div>
                  </td>
                </tr>
                {/volist}
              </tbody>
            </table>
          </div>
        </div>

      </div>
    </div>
        
  </div>
{/block}